extends Node2D

@export var rotation_speed = 10
@export var rotation_radius = 100

var tmp_rotation = 0

func _ready():
	#不执行process函数
	#set_process(false)
	
	#位于屏幕中央
	#position = Vector2(get_window().size.x,get_window().size.y) * 0.5
	pass

func _process(delta: float) -> void:
	# 围绕自己中心在转
	rotation_by_self(delta)
	
	# 围着一个点在转,并且自己在转
	#rotaion_by_pos(delta)
	
	# 围着一个点在转,自己不转
	#rotaion_by_pos2(delta)
	
	
# 围绕自己中心在转
func rotation_by_self(delta: float):
	rotation += rotation_speed * delta
	
	
# 围着一个点在转,并且自己在转
func rotaion_by_pos(delta: float):
	#tmp_rotation += rotation_speed * delta
	rotation += rotation_speed * delta
	
	var velocity = Vector2.ZERO
	velocity = Vector2.UP.rotated(rotation) * rotation_radius
	position += velocity * delta
	
	
# 围着一个点在转,自己不转
func rotaion_by_pos2(delta: float):
	tmp_rotation += rotation_speed * delta
	
	var velocity = Vector2.ZERO
	velocity = Vector2.UP.rotated(tmp_rotation) * rotation_radius
	position += velocity * delta

	
